﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Walking.Master" CodeBehind="article.aspx.vb" Inherits="walkingweb.article" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p>
        <asp:DataList ID="articlepost" runat="server" DataKeyField="PostID" 
            DataSourceID="getstartedarticle" Font-Size="Small" Width="90%">
            <ItemTemplate>
            <table class="tabarticle">
        <tr>
            <td class="tabarticletitle"><asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' Font-Bold="True" Font-Size="Medium" />
            <br />
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td> &nbsp;<asp:Label ID="Content1Label" runat="server" Text='<%# Eval("Content1") %>' />
            <br /></td>
            <td>
                   <asp:Image ID="Image1" runat="server" Visible='<%# If(Eval("Pic1") Is DbNull.Value, "False","True") %>'
                       ImageUrl='<%# string.format("/postpics/{0}", Eval("Pic1")) %>' />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;<asp:Label ID="Content2Label" runat="server" Text='<%# Eval("Content2") %>' /> <br /></td>
            <td>
                <asp:Image ID="Image2" runat="server" Visible='<%# If(Eval("Pic2") Is DbNull.Value, "False","True") %>'
                    ImageUrl='<%# string.format("/postpics/{0}", Eval("Pic2")) %>' />
            </td>
        </tr>
        <tr>
            <td>&nbsp;<asp:Label ID="Content3Label" runat="server" Text='<%# Eval("Content3") %>' /> <br /></td>
            <td>
                  <asp:Image ID="Image3" runat="server" Visible='<%# If(Eval("Pic3") Is DbNull.Value, "False","True") %>'
                      ImageUrl='<%# string.format("/postpics/{0}", Eval("Pic3")) %>' />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;<asp:Label ID="Content4Label" runat="server" Text='<%# Eval("Content4") %>' /> <br /><br /></td>
            <td> 
                <asp:Image ID="Image4" runat="server" Visible='<%# If(Eval("Pic4") Is DbNull.Value, "False","True") %>'
                    ImageUrl='<%# string.format("/postpics/{0}", Eval("Pic4")) %>' />
            </td>
        </tr>
        <tr>
            <td colspan="2">Posted: <asp:Label ID="DatePostedLabel" runat="server" Text='<%# Eval("DatePosted") %>' Font-Italic="True" /></td>
        </tr>
    </table>
            </ItemTemplate>
        </asp:DataList>
    </p>
    <p>
        <asp:SqlDataSource ID="getstartedarticle" runat="server" 
            ConnectionString="<%$ ConnectionStrings:walkingweb %>" 
            ProviderName="<%$ ConnectionStrings:walkingweb.ProviderName %>" 
            SelectCommand="SELECT * FROM [posts] WHERE ([PostID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="PostID" QueryStringField="PostID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
    </p>
    <p>
        <asp:Button ID="btn_likepost" runat="server" Text="Like this article" />
    </p>
    <p>
        <asp:Label ID="lbl_like" runat="server" Text="You like this article!"></asp:Label>
    </p>
    <p>
        &nbsp;<asp:GridView ID="postlikescountdisplay" runat="server" AutoGenerateColumns="False" 
            DataSourceID="postlikescount" GridLines="None">
            <Columns>
                <asp:BoundField DataField="VisitorLikes" HeaderText="Article Likes" 
                    SortExpression="VisitorLikes" >
                <ControlStyle BorderStyle="None" BorderWidth="0px" />
                </asp:BoundField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="postlikescount" runat="server" 
            ConnectionString="<%$ ConnectionStrings:walkingweb %>" 
            ProviderName="<%$ ConnectionStrings:walkingweb.ProviderName %>" 
            SelectCommand="SELECT [VisitorLikes] FROM [postlikescountquery] WHERE ([PostID_fk] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="PostID_fk" QueryStringField="PostID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
        </p>
    <hr />
    <p>
        Comments:</p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="existingcomments">
            <Columns>
                <asp:BoundField DataField="Visitor" HeaderText="Visitor" 
                    SortExpression="Visitor" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="WebsiteURL" HeaderText="WebsiteURL" 
                    SortExpression="WebsiteURL" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Content" HeaderText="Content" 
                    SortExpression="Content" />
                <asp:BoundField DataField="DatePosted" HeaderText="DatePosted" 
                    SortExpression="DatePosted" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="existingcomments" runat="server" 
            ConnectionString="<%$ ConnectionStrings:walkingweb %>" 
            ProviderName="<%$ ConnectionStrings:walkingweb.ProviderName %>" 
            SelectCommand="SELECT [Visitor], [Email], [WebsiteURL], [Title], [Content], [DatePosted] FROM [postcomments] WHERE ([PostID_fk] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="PostID_fk" QueryStringField="PostID" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <hr />
    <p>
        Comment on this article</p>
    <p>
        Name:&nbsp;
        <asp:Label ID="lbl_postcommentname" runat="server" Text="Label"></asp:Label> 
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<asp:LoginStatus ID="commentasmember" runat="server" 
            LoginText="Log in to comment as member" LogoutText="" />
    </p>
    <p>
        Email (required)<br />
&nbsp;<asp:TextBox ID="tb_articlecommentemail" runat="server"></asp:TextBox>
    </p>
    <p>
        Website URL (optional):<br />
        <asp:TextBox ID="tb_articlecommenturl" runat="server"></asp:TextBox>
    </p>
    <p>
        Title of comment (required, 50 character limit):<br />
        <asp:TextBox ID="tb_articlecommenttitle" runat="server"></asp:TextBox>
    </p>
    <p>
        Your comment below (required, 2000 character limit)<br />
        <asp:TextBox ID="tb_articlecommentcontent" runat="server" Height="252px" TextMode="MultiLine" 
            Width="377px"></asp:TextBox>
    </p>
    <p>
        <asp:Button ID="btn_articlecommentadd" runat="server" Text="Add Comment" />
    </p>
    <hr />
    <p>
        Tag this article</p>
    <p>
        <asp:CheckBoxList ID="cbl_addexistingtag" runat="server" DataSourceID="posttaglist" 
            DataTextField="TagText" DataValueField="TagID" RepeatDirection="Horizontal">
        </asp:CheckBoxList>
    </p>
    <p>
        Type in new tags you wish to add to the artilce.&nbsp; Please separate each tag 
        by a comma.<br />
        <asp:TextBox ID="tb_addnewtags" runat="server" Height="25px" Width="444px"></asp:TextBox>
        <asp:SqlDataSource ID="posttaglist" runat="server" 
            ConnectionString="<%$ ConnectionStrings:walkingweb %>" 
            ProviderName="<%$ ConnectionStrings:walkingweb.ProviderName %>" 
            SelectCommand="SELECT [TagID], [TagText] FROM [tags]"></asp:SqlDataSource>
    </p>
    <p>
        <asp:Button ID="Button1" runat="server" Text="Tag the article" />
    </p>
    <p>
        &nbsp;</p>
</asp:Content>
